<?php 
$sql =	"SELECT
			  c.sef_url AS class,
			  d.Name,
			  d.description,
			  d.meta_key,
			  d.meta_description	
		  FROM
			  category AS c,
			  category_description AS d
		  WHERE
		  
			  c.category_id = d.category_id
			  AND
			  d.lang_id = '".$_SESSION['lang_id']."'
			  AND
			  c.category_id = '".$sef_url."'
		  ";
$result = query($sql);
$row = mysql_fetch_object($result);


head(sth($row->Name),sth($row->meta_description),sth($row->meta_key));


?>

    <section id="content" class="cf">
        
        <div class="gr1 left table-display-nm">
            <a href="<?=HTML_BASE.$_SESSION['lang']?>/collections" class="<?=$row->class?> blank" target="_blank">
                <span>&larr; <?=$row->Name?></span>
            </a>
        </div>
        
        <?php 

            $sql = "SELECT
            c.cover,
			c.out_link,

            d.title,
            s.sef_url


        FROM
            projects AS c,
            project_description AS d,
            project_to_category AS p2c,
            sef_url AS s
        WHERE
            p2c.project_id =  c.project_id
            AND 
            p2c.category_id = '".$sef_url."'
            AND 
            s.query = c.project_id

            AND

            c.project_id = d.project_id

            AND
            s.tamplate='collection'

            AND

            d.lang_id = '".$_SESSION['lang_id']."'

            AND

            s.lang_id = '".$_SESSION['lang_id']."'

            AND c.published


            ORDER BY  c.order_number DESC

          ";
        $result = query($sql);

        while ($row = mysql_fetch_object($result)) {

		if($row->out_link){
			
		?>
        <div class="gr1 left">
         
             <a href="<?=$row->out_link?>" class="<?=$row->class?> blank"  target="_blank">
                <img class="hover-item" data-caption="<?=$row->title?>" src="<?=HTML_BASE?>project_images/covers/<?=$row->cover?>" alt="<?=$row->title?>" title="<?=$row->title?>"/>
            </a>
        </div>
            
        <?php
			
		}else{
		?>
        
        <div class="gr1 left">
         
             <a href="<?=HTML_BASE.$_SESSION['lang']?>/<?=$row->sef_url?>" class="<?=$row->class?>">
                <img class="hover-item" data-caption="<?=$row->title?>" src="<?=HTML_BASE?>project_images/covers/<?=$row->cover?>" alt="<?=$row->title?>" title="<?=$row->title?>"/>
            </a>
        </div>
        
        <?php 
			}
		}?>

        
    </section>



		
		
<?php
foot();
?>